public class Text5 {
    public static void main(String[] args) {
        int max = 20;
        int n = 40;
        int temp;
        if(max<n){
            temp = max;
            max = n;
            n = temp;
        }
        for (int i = n; i >0 ; i--) {
            if(max%i == 0 && n%i == 0){
                System.out.println("最大公约数为"+i);
                break;
            }

        }
    }
}
